package org.cuatrovientos.erp.business;

import java.util.List;

import org.cuatrovientos.erp.model.Product;
import org.cuatrovientos.erp.dao.ProductDAO;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Holds all the business logic for Product related management
 * @author Daniel Cobo
 * @greetz Any
 *
 */
public class ProductBO implements BOGenericInterface {
	
	// Get log4j logger
	private static final Logger logger = Logger.getLogger(ProductBO.class);
	
	@Autowired
    private ProductDAO productDAO;

	@Override
	public Product selectById(int id) {
		logger.info("selectById: " + id);
		return productDAO.selectById(id);
	}

	@Override
	public List<Product> selectAll() {
		logger.info("selectAll: ");
		return productDAO.selectAll();
	}



	@Override
	public void deleteById(int id) {
		logger.info("delete: " + id);
		 productDAO.delete(id);
	}

	@Override
	public void insert(Object product) {
		logger.info("insert: " + product);
		productDAO.insert(product);
	}

	@Override
	public void update(Object product) {
		logger.info("update: " + product);
		productDAO.update(product);
	}


}
